using System;
using System.Text;
namespace ns4
{
	public sealed class BitArray
	{
		public int[] bits;
		public int size;
		public int Size
		{
			get
			{
				return this.size;
			}
		}
		public bool Renamed
		{
			get
			{
				return (this.bits[int_0 >> 5] & 1 << int_0) != 0;
			}
		}
		public int Renamed
		{
			set
			{
				this.bits[value >> 5] |= 1 << value;
			}
		}
		public BitArray(int size)
		{
			if (size < 1)
			{
				throw new ArgumentException("size must be at least 1");
			}
			this.size = size;
			this.bits = BitArray.smethod_0(size);
		}
		public void flip(int int_0)
		{
			this.bits[int_0 >> 5] ^= 1 << int_0;
		}
		public void setBulk(int int_0, int newBits)
		{
			this.bits[int_0 >> 5] = newBits;
		}
		public void clear()
		{
			int num = this.bits.Length;
			for (int i = 0; i < num; i++)
			{
				this.bits[i] = 0;
			}
		}
		public bool isRange(int start, int int_0, bool value_Renamed)
		{
			if (int_0 < start)
			{
				throw new ArgumentException();
			}
			bool result;
			if (int_0 == start)
			{
				result = true;
			}
			else
			{
				int_0--;
				int num = start >> 5;
				int num2 = int_0 >> 5;
				for (int i = num; i <= num2; i++)
				{
					int num3 = (i > num) ? 0 : (start & 31);
					int num4 = (i < num2) ? 31 : (int_0 & 31);
					int num5;
					if (num3 == 0 && num4 == 31)
					{
						num5 = -1;
					}
					else
					{
						num5 = 0;
						for (int j = num3; j <= num4; j++)
						{
							num5 |= 1 << j;
						}
					}
					if ((this.bits[i] & num5) != (value_Renamed ? num5 : 0))
					{
						result = false;
						return result;
					}
				}
				result = true;
			}
			return result;
		}
		public int[] getBitArray()
		{
			return this.bits;
		}
		public void reverse()
		{
			int[] array = new int[this.bits.Length];
			int num = this.size;
			for (int i = 0; i < num; i++)
			{
				if (this.get_Renamed(num - i - 1))
				{
					array[i >> 5] |= 1 << i;
				}
			}
			this.bits = array;
		}
		private static int[] smethod_0(int int_0)
		{
			int num = int_0 >> 5;
			if ((int_0 & 31) != 0)
			{
				num++;
			}
			return new int[num];
		}
		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder(this.size);
			for (int i = 0; i < this.size; i++)
			{
				if ((i & 7) == 0)
				{
					stringBuilder.Append(' ');
				}
				stringBuilder.Append(this.get_Renamed(i) ? 'X' : '.');
			}
			return stringBuilder.ToString();
		}
	}
}
